\b0 BitmapTest is a simple program to test the speed of animating bitmaps on the screen. It also allows various optimizations to be turned on and off, to see how much they help. This program is intended as a demo program for developers, and is in the Public Domain. No claims are made to the usefulness or suitability of this program, or its source code.\
This program demonstrates animating bitmaps, use of timer & event handling, use of the List object, limiting window resizing, and includes a simple generic object to handle moving a bitmap.\
Comments are welcomed to help make this a better demo program. The code is intended to provide clear, correct use of the App Kit, rather than fast, but dirty code.\
\b\fs28 Basic Operation:\
\fs24 \
\b0 The simplest way to use the program is to click the "Create" button once, and then click the "Start" button. a small bitmap should appear and then begin bouncing around the view. Clicking "Create" again will add another bitmap. The check boxes in the Control section allow various optimizations described below.\
\b\fs28 New Bitmap Options:\
\fs24 \
Create:
\b0 Creates a new bitmap using the parameters described below.\
Bitmap Size:
\b0 Sets the size of the bitmap used for the next bitmap. The bitmaps were made with the Icon App, and added to the .nib file in the tiff files section of the project inspector. You can replace them and re-compile. Alpha values other than 0 and 1, and nicer pictures could easily have been used.\
Remove Last One:
\b0 Removes the last created bitmap.\
Number:
\b0 Shows how many bitmaps are on the screen.\
Initial Velocity:
\b0 Lets you set the initial bitmap velocities in units/move. The units are points, or screen pixels. The initial position is always the center of the view. The "Random" check box will disable these inputs and assign random velocities from -5 to 5 on creation.\
\fs28 Control Options:\
\fs24 \
Start:
\b0 Toggle to start and stop the motion of the bitmaps.\
Allocate G State:
\b0 Allocates/de-allocates a graphics state for the View. This takes a lot of memory, and is only recommended for computationally intensive and important Apps. Note that the Tight Draw Loop (below) is actually faster and more efficient.\
NX_PING:
\b0 Synchronizes the window server after each draw for smoother animation.\
Erase Background:
\b0 Erases the whole view before each redraw step. This is slower than erasing just the bitmaps for big views, and few numbers of bitmaps. Click this on and off to clear the view.\
Erase Bitmaps:
\b0 Erases the area behind each bitmap before each step of the animation. This is faster than erasing the whole screen for a small number of bitmaps, but as the number gets larger, the overhead of messaging and erasing each bitmap has a bigger effect.\
Tight Draw Loop:
\b0 Makes the animation go in a continuous loop until an event is received. The graphics state is locked and unlocked just once. In this program, the timer is ignored when using this optimization, but that could have been easily allowed for. Notice that using a tight draw loop is the fastest way to keep the animation going. It will stop for events, and doesn't take a lot of Display PostScript memory like allocating a GState does.\
Timer Period:
\b0 Lets you specify the time in seconds between each redraw (decimal fractions are OK). Note that this will not have an effect if a tight drawing loop is used, although that funtionality could be easily added.\